<extend file='../jionCart'/>
<block name="content">
<div class="lgw">
		<div class="lg cl">
			<div class="lgl fl">
				<a href="">
					<img src="{{__ROOT__}}/resource/img/logo-ico.jpg" alt="">
				</a>
				<span class="logoname">
					<img src="{{__ROOT__}}/resource/img/logoname.jpg" alt="">
				</span>
			</div>
			<div class="lgr fr">
				<ul>
					<li class="fol vtd">
						<h2 class="h_1">
							<span>选购商品</span>
						</h2>
					</li>
					<li class="on">
						<h2 class="h_2">
							<span>提交订单</span>
						</h2>
					</li>
					<li >
						<h2 class="h_3">
							<span>支付订单</span>
						</h2>
					</li >
					<li class="eol_p">
						<h2 class="h_4">
							<span>等待签收</span>
						</h2>
					</li>
				</ul>
			</div>
		</div>
	</div>
</div>
<div class="ar arct arcrt">
	<div class="arc mct">
		<div class="arci">
			<div class="bx bx1">
				<div class="bxt">
					<h2 >购物车</h2>
				</div>
				<div class="bxc">
					<div class="bxci">
						<div class="gdfw fw mblk">
							<div class="glw">
								<table id="goods_list" class="goods cgoods">
										<tbody>
										<tr class="cl hli fov">
											<th class="ghw">商品</th>
											<th class="gphw">单价</th>
											<th class="gnhw">数量</th>
											<th >小计</th>
											<th class="gohw">操作</th>
										</tr>
										<foreach from="$_SESSION['cart']['goods']" key="$k" value="$v">
										<tr class="cl gilw hli checked" attr="{{$k}}">
											<td class="gw">
												<dl class="cl">
													<dt>
<!--														<span><input type="checkbox" name="" id=""></span>-->
														<a href=""><img src="{{$v['pic']}}" alt=""></a>
													</dt>
													<dd style="margin-top: 17px; display: block;">
														<p class="tt"><a href="">{{$v['name']}}</a></p>
														<p class="ct"><span style="color: orangered;font-size: 12px;">{{$v['options']}}</span></p>
														<p class="ct">附送说明书，全球联保卡</p>
													</dd>
												</dl>
											</td>
											<td class="gpw">
												<p class="gp">
													￥<span class="orders_price" num="" >{{$v['price']}}</span>.00
												</p>
											</td>
											<td class="gp">
												<p   class="kp">
													<span class="oprt now strip" style="position: relative; top: 20px; left: 27px; display: block; width: 21px; height: 21px;cursor: pointer;">-</span>
													<input type="text" name="" id="num_1" class="num ti" value="{{$v['num']}}" style="text-align: center;">
													<span  class="oprt now plus" style="position: relative; top: -20px; left: 76px; width: 21px; height: 21px; display: block;cursor: pointer;">+</span>
												</p>
											</td>
											<td class="gpw">
												<p class="gp">
													￥<span class="orders_price store-price" >{{$v['total']}}</span>.00
												</p>
											</td>
											<td class="gow">
												<p>
													<a href="" class="oprt clt">收藏</a>
													<span class="sep"></span>
													<a href="JavaScript:;" class="oprt del" kk="{{$k}}">删除</a>
												</p>
											</td>
										</tr>
										</foreach>
									</tbody>
								</table>

							</div>
						</div>
						<?php if($_SESSION['cart']['goods']){?>
							<div style="display: none" >
								<span>没有商品，<a href="">请购物</a></span>
							</div>
						<?php }else{?>
							<div style="display: block" >
								<span>没有商品，<a href="">请购物</a></span>
							</div>

						<?php } ?>



						<script>
							$(function() {
								$('.plus').click(function () {
									var kk = $(this).parents('.checked').attr('attr');
									var _this = $(this);
									$.ajax({
										type: 'post',
										url: "{{u('addNum')}}",
										data: {kk: kk},
										dataType: 'json',
										success: function (phpData) {
											_this.parents('.gp').siblings('.gpw').find('.store-price').text(phpData.price);
										   _this.parents('.kp').find('.num').val(phpData.num);
											$('.osp').find('.orders_all').text(phpData.total);
										}
									});
								})
								$('.strip').click(function () {
									var vv = $(this).parents('.gilw').attr('attr');
									var _this = $(this);
									$.ajax({
										type: 'post',
										url: "{{u('stripNum')}}",
										data: {vv: vv},
										dataType: 'json',
										success: function (phpData) {
											_this.parents('.gp').siblings('.gpw').find('.store-price').text(phpData.price);
											_this.parents('.kp').find('.num').val(phpData.num);
											$('.osp').find('.orders_all').text(phpData.total);
										}
									});
								})
							})
						</script>
						<script>
							$(function(){
								$('.del').click(function(){
									var kk = $(this).attr('kk');
									if(confirm('确定删除吗??!!')){
										$(this).parents('.checked').remove();
										$.ajax({
											type:'post',
											url:"{{u('del')}}",
											data:{kk:kk},
											dataType:'json',
											success:function(phpData){
												$('.osp').find('.orders_all').text(phpData.newTotal);
											}
										})
									}
								})
							})
						</script>
						<div class="smaw">
							<p class="ospw">
								<span class="cpntw h" id="cost_points_wrap">
									需消耗积分：<span clacsss="em" id="cost_points">0</span>
								</span>
								商品总额：
								<span class="osp">
									￥<span id="order_amount" class="orders_all"><?php echo Cart::getTotalPrice(); ?></span>.00
								</span>
							</p>
							<p class="chk cl">
								<span >
									<label>你还可以</label>
									<a href="">继续购物</a>
								</span>
								<a href="{{u('order.index')}}"><input type="button" value="立即结算" name="checkout" class="si bt"></a>
							</p>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<!--正文结束-->
</block>